<include file="public@header" />
</head>
<body>
	
	<div class="wrap js-check-wrap">
		<div>
			<h4></h4>
		</div>

		<ul class="nav nav-tabs">
			<?php $currentTab = 1;?>		
            <include file="public/../system/nav" />
		</ul>
        <form class="well form-inline margin-top-20" method="post" action="">
            
        </form>
        <table class="table table-bordered">
        	<thead>
        		<tr>
        			<th style="width: 50px;">序号</th>
        			<th>类型</th>
        			<th>包名</th>
					<th>版本</th>
        			<th>更新时间</th>
					<th>备注说明</th>
                    <th>状态</th>
        			<th width="200" >操作</th>
        		</tr>
        	</thead>
        	<tbody>
        		<volist name="list" id="vo">
        		<tr>
                    <td>{++$key}</td>
                    <td>
                        <if condition="$vo['type'] eq 1">
                                系统文件
                            <else />
								系统框架
                        </if>
                    </td>
                    <td>{$vo.name}</td>
					<td>{$vo.version|default='-'}</td>
                    <td><?php if( !empty( $vo['add_time'] ) ){ echo date('Y-m-d H:i:s' , $vo['add_time']) ; } else { echo "-" ;} ?> </td>
                    <td style="word-break:break-all;" >{$vo.remarks|default=''}</td>
                    <td>
                        <if condition="$vo['status'] eq 0">
                                <span style="color:orange;">关闭</span>
                            <else/>
                                <span style="color:green;">开启</span>
                        </if>
                    </td>
                    <td>
                        <if condition="cmf_auth_check( cmf_get_current_admin_id() , 'admin/system/modifyStatus' )" >
                            <if condition ="$vo['status'] eq 0" >
                                <a href="{:url('admin/system/modifyStatus')}?id={$vo.id}&code=1" class="btn btn-success btn-xs zy-ajax-confirm" data-msg="确定要开启此记录吗?">开启</a>
                            <else/>
                                <a href="{:url('admin/system/modifyStatus')}?id={$vo.id}&code=0" class="btn btn-warning btn-xs zy-ajax-confirm" data-msg=""确定要关闭此记录吗?>关闭</a>
                            </if>
                        </if>
                        <if condition="cmf_auth_check( cmf_get_current_admin_id(), 'admin/system/addRemark' )" >
                            <a href="javascript:;" class="btn btn-info btn-xs" data-ms='{$vo.remarks|default=""}'  onclick="addRemark( this , {$vo.id}  );">备注</a>
                        </if>
						<if condition="cmf_auth_check( cmf_get_current_admin_id() , 'admin/system/delete' )" >
                            <a href="{:url('admin/system/delete')}?id={$vo.id}"  class="btn btn-danger btn-xs zy-ajax-confirm" data-msg="确定要删除此项记录！">删除</a>
                        </if>
                        <if condition="cmf_auth_check( cmf_get_current_admin_id() , 'admin/system/downloadFile' )" >
    						<a href="{:url('admin/system/downloadFile')}?id={$vo.id}" target="_blank" class="btn btn-info btn-xs">下载</a>
                        </if>
                    </td>
        		</tr>
        		</volist>
        	</tbody>
        </table>
	<empty name="$list">
		暂无记录~
	</empty>
	<div class="pagination">
     {$list->render()}   
    </div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/layer/layer.js"></script>
<script src="__STATIC__/js/custom/custom.js"></script>
<script>
    var addRemark = function( _this , id ){
		var msg = $(_this).data('ms');
        layer.prompt({
            formType: 2,
            value: msg,
            title: '备注信息',
            area: ['800px', '350px'] //自定义文本域宽高
            }, function(value, index, elem){
                $.post( '{:url("admin/system/addRemark")}' , { id : id , remarks : value } , function(data){
					data = JSON.parse(data);
                    let icon  = (data.code == 200 )?1:5;
                    layer.msg( data.message , { icon : icon });
                    if( data.code == 200 ){
                        setTimeout( function(){
                            window.location.reload();
                        } , 1200 );
                    }
                } );
            
        });
    }
</script>
</body>
</html>
